import request from '@/utils/request'

export default {
  listAll() {
    return request({
      url: '/user/all',
      method: 'get'
    })
  },
  listPage(currentPage, pageSize, queryUserDTO) {
    return request({
      url: `/user/search/${currentPage}/${pageSize}`,
      method: 'post',
      data: queryUserDTO
    })
  },
  deleteUser(ids) {
    return request({
      url: `/user/delete`,
      method: 'post',
      data: ids
    })
  },
  addUser(user) {
    return request({
      url: `/user/add`,
      method: 'post',
      data: user
    })
  },
  findById(id) {
    return request({
      url: `/user/${id}`,
      method: 'get'
    })
  },
  updateUser(user) {
    return request({
      url: `/user/update`,
      method: 'post',
      data: user
    })
  },
  nameIsExist(name) {
    return request({
      url: `/user/exist/name`,
      method: 'get',
      params: { name }
    })
  },
  selectAllUser() {
    return request({
      url: `/user/allName`,
      method: 'get'
    })
  },
  updateVip(id, vip) {
    return request({
      url: `/user/${id}/${vip}`,
      method: 'put'
    })
  },

  updateType(id, userType) {
    return request({
      url: `/user/update/${id}/${userType}`,
      method: 'put',
      // params:{id,userType}
    })
  }
}
